package cliente_diseno2011;

import java.awt.Image;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JLabel;

public class VistaAdmin extends JPanel {
	private JTextField textField;
	private JTextField textField_1;

	/**
	 * Create the panel.
	 */
	JButton btnCambiarHost;
	JButton btnCambiarPresidente;
	private JTextField textField_2;
	private JButton btnLogOut;
	private JTextField textField_3;

	public VistaAdmin() {

		btnCambiarPresidente = new JButton("Cambiar Presidente");

		textField = new JTextField("localhost");
		
		textField.setColumns(10);

		textField_1 = new JTextField("8888" );
		textField_1.setColumns(10);

		JLabel lblHost = new JLabel("Host");

		JLabel lblPuerto = new JLabel("Puerto");

		btnCambiarHost = new JButton("Cambiar Host");

		textField_2 = new JTextField();
		textField_2.setColumns(10);

		JLabel lblPingPresidenteNuevo = new JLabel("Ping Presidente Nuevo");

		btnLogOut = new JButton("Log Out");

		textField_3 = new JTextField("5000" );
		textField_3.setColumns(10);

		JLabel lblTimmer = new JLabel("Timmer");
		
		
		
		Image gob = new ImageIcon("./src/img/admin.jpg").getImage();
		JPanel panel = new BoletaPanel(gob);
		
		
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(88)
					.addComponent(lblHost)
					.addGap(140)
					.addComponent(lblPuerto)
					.addGap(59)
					.addComponent(lblTimmer)
					.addContainerGap(149, Short.MAX_VALUE))
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(179)
					.addComponent(btnLogOut, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED, 104, Short.MAX_VALUE)
					.addComponent(panel, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE)
					.addGap(58))
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(60)
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
						.addGroup(groupLayout.createSequentialGroup()
							.addComponent(textField, GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.UNRELATED)
							.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.UNRELATED)
							.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
							.addComponent(btnCambiarHost))
						.addGroup(groupLayout.createSequentialGroup()
							.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 207, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED, 111, Short.MAX_VALUE)
							.addComponent(btnCambiarPresidente)))
					.addGap(21))
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(104)
					.addComponent(lblPingPresidenteNuevo)
					.addContainerGap(312, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(46)
					.addComponent(lblPingPresidenteNuevo)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(btnCambiarPresidente)
						.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(42)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblHost)
						.addComponent(lblPuerto)
						.addComponent(lblTimmer))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(btnCambiarHost)
						.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addPreferredGap(ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
							.addComponent(btnLogOut, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)
							.addGap(36))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(35)
							.addComponent(panel, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE)
							.addContainerGap())))
		);
		setLayout(groupLayout);

	}

	public void addHostListener(ActionListener al) {
		btnCambiarHost.addActionListener(al);

	}

	public void addCambiarPresidenteListener(ActionListener al) {
		btnCambiarPresidente.addActionListener(al);

	}

	public void addLogOutListener(ActionListener al) {
		btnLogOut.addActionListener(al);

	}

	public String getPingPresidente() {
		return textField_2.getText();
	}

	public String getHost() {
		return textField.getText();
	}

	public String getPuerto() {
		return textField_1.getText();
	}

	public String getTimmer() {
		return textField_3.getText();
	}
}
